package algotithm.weekendrace.leetcode237.test4;

/**
 * @author zhouyanxiang
 * @Date 2021-04-2021/4/18-10:23
 */
class Solution {

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] arr1 = {1,2,3};
        int[] arr2 = {6,5};
        int xorSum = solution.getXORSum(arr1, arr2);
        System.out.println(xorSum);
    }

    public int getXORSum(int[] arr1, int[] arr2) {
        int n = arr1.length;
        int m = arr2.length;
        long cnt1 = 0;
        long cnt2 = 0;
        for (int i = 0; i < n; i++) {
            cnt1 ^= arr1[i];
        }
        for (int i = 0; i < m; i++) {
            cnt2 ^= arr2[i];
        }
        long sum = cnt1 & cnt2;
        return (int) sum;
    }
}
